package com.example.springboot.json.controller;

import com.example.springboot.json.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 使用@RestController等价于@Controler @ResponseBody
 *
 * @author wangsh
 * @date 2018/5/4 23:53
 */
@RestController
public class FastJsonController {
	/**
	 * 请求映射：http://localhost:8080/hello
	 *
	 * @return
	 */
	@RequestMapping("/hello")
	public String hello() {
		System.out.println("hello...........");
		return "hello";
	}

	/**
	 * 请求映射：http://localhost:8080/getUser
	 *
	 * @return
	 */
	@RequestMapping("/getUser")
	public User getUser() {
		User user = new User();
		user.setId("1111111");
		user.setUserName("zhangsan");
		user.setPassword("123");
		user.setCreateTime(new Date());
		return user;
	}
}
